<?php
/**
 * ===============================================
 * 版权所有 2019-2050 青岛铁锤科技有限公司，并保留所有权利。
 * 网站地址: http://www.huaxianling.com
 * ===============================================
 * Author: Rag Hu
 * Created Time: 2019/7/9 14:59
 * Modified Time: 2019/7/9 14:59
 * Version: 2.0
 */

namespace App\Models;

use Encore\Admin\Traits\AdminBuilder;
use Encore\Admin\Traits\ModelTree;
use Illuminate\Database\Eloquent\Model;

class DictionaryItem extends Model
{
	use AdminBuilder, ModelTree {
		ModelTree::boot as treeBoot;
	}
    protected $table = 'dictionary_item';

    protected $fillable = [
        'parent_id',
        'code',
        'fullname',
        'status',
        'order'
    ];

    public function dictionary(){
    	return $this->belongsToMany(Dictionary::class,'id','parent_id');
    }

    public function picture(){
    	return $this->hasOne(Picture::class,'id','resource');
    }

    public function service(){
        return $this->hasMany(Service::class,'type','id');
    }
}